package com.ag.zrt.action;

import javax.annotation.Resource;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.ag.bean.TbEventLevel;
import com.ag.common.BaseAction;
import com.ag.zrt.service.EventLevelService;
@Controller("updateEventLevelAction")
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class UpdateEventLevelAction extends BaseAction {

	private static final long serialVersionUID = -8562096200231501646L;

	private String elId;
	private String el;
	private String elColor;
	private TbEventLevel eventLevel = new TbEventLevel();
	@Resource(name="EventLevelService")
	private EventLevelService eventLevelService;
	private String msg;
	private String errorDetail;

	@Override
	public String execute() {
        try{
		eventLevel.setElId(elId);
		eventLevel.setElEventLevel(el);
		eventLevel.setElColor(elColor);
		eventLevelService.update(eventLevel);
		msg = "更新成功";
		errorDetail = "";
		return "update_el_succ";
        }catch(Exception e){
        	msg = "更新失败";
        	errorDetail = e.toString();
        	return "update_el_failed";
        }

	}

	public String getEl() {
		return el;
	}

	public String getMsg() {
		return msg;
	}

	public String getErrorDetail() {
		return errorDetail;
	}

	public String getElId() {
		return elId;
	}

	public void setEl(String el) {
		this.el = el;
	}

	public void setElColor(String elColor) {
		this.elColor = elColor;
	}

	public void setElId(String elId) {
		this.elId = elId;
	}

	public void setEventLevel(TbEventLevel eventLevel) {
		this.eventLevel = eventLevel;
	}

	public void setEventLevelService(EventLevelService eventLevelService) {
		this.eventLevelService = eventLevelService;
	}

}
